package com.sx.zongzhi.presenter;

import com.sx.zongzhi.MyApplication;
import com.sx.zongzhi.bean.AppealDetailBean;
import com.sx.zongzhi.modle.ApiManager;
import com.sx.zongzhi.net.BaseCallBack;
import com.sx.zongzhi.net.BaseResult;
import com.sx.zongzhi.view.IAppealDetailView;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by XZY on 2017/11/30.
 *获取诉求服务详情
 */
public class AppealDetailPest {

    private IAppealDetailView iAppealView;

    public AppealDetailPest(IAppealDetailView iAppealView) {
        this.iAppealView=iAppealView;
    }


    /**
     *
     * @param appealId 诉求事件id
     * @param sourcesWay 处理来源编号
     * @param stepRecordId 诉求步骤事件主键
     */
    public void getAppealDetail(String appealId, int sourcesWay,String stepRecordId){
        Map<String,Object> map=new HashMap<>();
        map.put("sid", MyApplication.sid);
        map.put("appealId", appealId);
        map.put("sourcesWay", sourcesWay);
        map.put("stepRecordId", stepRecordId);
        new ApiManager().getAppealDetail(map, new BaseCallBack<BaseResult<AppealDetailBean>>() {
            @Override
            public void onSuccess(BaseResult<AppealDetailBean> response) {
                iAppealView.getAppealDetail(response.getData());
            }
            @Override
            public void onFailures(String message) {
                iAppealView.showError(message);
            }
        });
    }

}
